home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
pc
/
data
/
menu_dvd.swf
/
scripts
/
__Packages
/
CDialogManager.as
< prev
next >
Wrap
Text File
|
2007-11-07
|
3KB
|
130 lines
class CDialogManager extends mx.core.UIObject
{
var mLoading = false;
function CDialogManager()
{
super();
this._visible = false;
this.init();
}
function init()
{
this.mEnableGrab = true;
this.mStartX = 40;
this.mStartY = 205;
this.mX = this._x;
this.mY = this._y;
this.mFile = "";
this.mFrame = "";
this.mLoading = false;
this.mc_ProgressBar._visible = false;
this.createEmptyMovieClip("content",3);
this.content._x = this.mStartX;
this.content._y = this.mStartY;
this.Show(false);
this.content.onPress = function()
{
};
this.content.useHandCursor = false;
this.mc_DialogGrabR.onPress = mx.utils.Delegate.create(this,this.onGrabClick);
}
function onGrabClick()
{
this.Show(false);
}
function LoadContents(inFile, inMarker, inModal)
{
trace("LoadContents" + inFile);
this.Show(true,inModal);
if(inFile != this.mFile)
{
if(this.mFile != "")
{
this.content.unloadMovie();
}
this.mFile = inFile;
this.mFrame = inMarker;
this.mLoading = true;
this.mc_ProgressBar._visible = true;
this.content.loadMovie(this.mFile);
}
else
{
this.mFrame = inMarker;
if(!this.mLoading)
{
this.JumpToMarker();
}
}
}
function GoMarker(inMarker)
{
if(this.mFile != "")
{
this.content.gotoAndStop(inMarker);
}
}
function onEnterFrame(inValue)
{
if(this.mLoading)
{
var bLoaded = this.content.getBytesLoaded();
var bTotal = this.content.getBytesTotal();
var factor = Math.min(bLoaded / bTotal * 100,100);
this.mc_ProgressBar.SetProgress(factor);
if(bLoaded >= bTotal && bTotal != 0)
{
trace("done");
this.mc_ProgressBar.SetProgress(100);
this.mc_ProgressBar._visible = false;
this.mLoading = false;
if(this.mFrame != "")
{
this.JumpToMarker();
this.doLater(this,"JumpToMarker");
trace("content.gotoAndStop " + this.mFrame);
}
}
}
}
function JumpToMarker()
{
trace("JumpToMarker");
if(this.mFrame == "")
{
return undefined;
}
if(this.content.VaiA)
{
this.content.VaiA(this.mFrame);
}
else
{
this.content.gotoAndStop(this.mFrame);
}
}
function Show(inTrueFalse, inModal)
{
trace("SHOW");
if(inModal == undefined)
{
inModal = true;
}
if(inTrueFalse != this.content._visible)
{
this.content._visible = inTrueFalse;
}
if(inTrueFalse)
{
this.content._x = this.mStartX;
this.content._y = this.mStartY;
}
this.mc_DialogGrabR._visible = inModal && inTrueFalse;
this._visible = inTrueFalse;
}
function onUnload()
{
this.content.removeMovieClip();
}
}